package com.tyut.rongxiaotong.common;

import lombok.Data;

/**
 * @Title: Result
 * @Author Wood
 * @Package com.tyut.rongxiaotong.common
 * @Date 2025/5/31 13:56
 * @description:
 */
public class Result<T>{
    private int code;
    private String message;
    private T data;

    public Result(int code,String message){
        this.code = code;
        this.message = message;
        this.data = null;
    }

    public Result(int code,String message,T data){
        this.code = code;
        this.message = message;
        this.data = data;
    }

    public static <T> Result<T> success(){
        return new Result<>(200,"操作成功",null);
    }

    public static <T> Result<T> success(T data){
        return new Result<>(200,"操作成功",data);
    }

    public static <T> Result<T> fail(){
        return new Result<>(500,"操作失败",null);
    }

}
